---
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
```
```{r, message=FALSE}
library(tidyverse)
library(p8105.datasets)
library(plotly)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
data(nyc_airbnb)
nyc_airbnb %>%
mutate(text_label = str_c("Price: $", price, "\nreview_scores_location: ", review_scores_location)) %>%
plot_ly(
x = ~lat, y = ~long, type = "scatter", mode = "markers",
color = ~price, text = ~text_label, alpha = 0.5)
```
Column {data-width=350}
-----------------------------------------------------------------------
### Chart B
```{r}
nyc_airbnb %>%
mutate(neighbourhood = fct_reorder(neighbourhood, price)) %>%
plot_ly(y = ~price, color = ~neighbourhood, type = "box", colors = "viridis")
```
### Chart C
```{r}
nyc_airbnb %>%
count(neighbourhood) %>%
mutate(neighbourhood = fct_reorder(neighbourhood, n)) %>%
plot_ly(x = ~neighbourhood, y = ~n, color = ~neighbourhood, type = "bar", colors = "viridis")
```